package com.duobaoyu.dby.supply.common.biz.bo.refund;

import lombok.AllArgsConstructor;
import lombok.Builder;
import lombok.Data;
import lombok.NoArgsConstructor;

import java.math.BigDecimal;
import java.util.List;

/**
 * Created by shuming on 2023/10/12 17:19
 */
@Data
public class AfterSaleStateContext {

    /**
     * 售后数据
     */
    private AfterSaleOutBO afterSale;

    /**
     * 变更后状态
     */
    private Integer currentAfterSaleStatus;

    /**
     * 变更模型
     */
    private ChangeContentOperate changeContentOperate;

    /**
     * 操作源
     */
    private String operateSource;

    @Data
    @AllArgsConstructor
    @NoArgsConstructor
    @Builder
    public static class ChangeContentOperate {

        /**
         * 渠道售后编码
         */
        private String channelAfterSaleSn;
        /**
         * 失败原因
         */
        private String failReason;

        /**
         * 取消原因
         */
        private String cancelRemark;

        /**
         * 客户寄回地址
         */
        private CustomerReturnAddressBO customerReturnAddress;

        /**
         * 运单号
         */
        private AfterSaleWayBillInBO afterSaleWayBill;

        /**
         * 渠道方式
         */
        private Integer newPickupType;
        /**
         * 申请退款运费
         */
        private BigDecimal freightApplyRefundAmount;

        /**
         * 运费实际退款金额
         */
        private BigDecimal channelFreightActualRefundAmount;

        /**
         * 实际退款金额
         */
        private BigDecimal channelActualRefundAmount;

        /**
         * 售后明细
         */
        private List<AfterSaleUpdateItemInfo> afterSaleItemInfoList;
    }

    @Data
    public static class AfterSaleUpdateItemInfo {
        private Long id;
        /**
         * 货物状态 0->默认；1->售中等待买家发货;2->售中等待买家收货;3->售中已收货（未确认完成交易）;4->售后未收货;5->售后已收到货
         * <p>
         * //@see com.duobaoyu.dby.channel.adapter.enums.biz.product.GoodsStatusEnum
         */
        private Integer goodsStatus;

        /**
         * sku编码
         */
        private String skuCode;
        /**
         * 售后原因编码
         */
        private String reasonCode;
        /**
         * 售后原因说明
         */
        private String reasonName;
        /**
         * 申请退款金额（不包含运费）
         */
        private BigDecimal channelApplyAfterSaleAmount;
        /**
         * 申请退款金额（不包含运费）
         */
        private BigDecimal freightApplyRefundAmount;


        /**
         * 渠道退款金额
         */
        private BigDecimal channelActualRefundAmount;

        /**
         * 运费实际退款金额
         */
        private BigDecimal channelFreightActualRefundAmount;
    }
}
